const fs = require('fs');

const dirRoot = './images/php-shop/';
let path = '', arr = [],data={};
fs.readdirSync(dirRoot).forEach(dirname => {
    if (dirname.includes('.')) {
        return;
    }
    path = dirRoot + dirname + '/';
    arr = [];
    fs.readdirSync(path).forEach(filename => {
        arr.push({ text: filename, value: path + filename });
    })
    data[dirname]=arr;
})
fs.writeFileSync(dirRoot + 'all.json', JSON.stringify(data));
console.log('done.');